/*
 * Class:CEMEvent
 * 
 * Description: 
 * 
 * Version:
 * 1.0 - Nikolay Neshev, Sonny Guenette - 28-10-2011
 * 		Initial implementation.
 * 1.1 - Sonny Guenette - 29-10-2011
 * 		Coded the constructor and the setter methods.
 * 1.2 - M-A Lavoie - 2011-12-04
 * 		Coded event id and agenda id getters and setters.
 *      Removed unused event date and duration variables.
 *      Renamed methods to lowerCase.
 *      
 * Copyright GPP - Genuine People Personality inc
 * 
 */

package calendarEventManager;

import java.lang.String;
import java.sql.Timestamp;

public class CEMEvent implements CEMConstants {

	//**************************************************************
	// MODAL VARIABLES
	//**************************************************************
	/** Id of the current event*/
	private int m_nEventId;
	/** The current event's name*/
	private String m_sEventName;
	/** The current event's starting time*/
	private Timestamp m_oEventStartTime;
	/** The current event's ending time*/
	private Timestamp m_oEventEndTime;
	/** A short description of the current event*/
	private String m_sEventDescription;
	/** Id of the agenda of the current event*/
	private int m_nAgendaId;
	
	//**************************************************************
	// Method: CEMEvent
	// Description: Class Constructor
	//**************************************************************
	/**
	 * @param p_nEventId
	 *  	The id of the event. 
	 * @param p_sName
	 * 		The name given to the event.
	 * @param p_oStartTime
	 * 		The starting time of the event.
	 * @param p_oEndTime
	 * 		The ending time of the event.
	 * @param p_sDescription
	 * 		The description of the event. 
	 * @param p_nAgendaId
	 * 		The id of the agenda. 
	 */
	public CEMEvent(int p_nEventId, String p_sName, Timestamp p_oStartTime,
					Timestamp p_oEndTime, String p_sDescription, int p_nAgendaId) {
		this.m_nEventId         	= p_nEventId;
		this.m_sEventName 			= p_sName;
		this.m_oEventStartTime 		= p_oStartTime;
		this.m_oEventEndTime 		= p_oEndTime;
		this.m_sEventDescription 	= p_sDescription;
		this.m_nAgendaId        	= p_nAgendaId;
	} // CEMEvent()	

	//**************************************************************
	// Method: setEventId
	// Description: The setter of the event id. Used when an event
	//				needs to be modified.
	//**************************************************************
	/**
	 * @param p_nEventId
	 * 		The new event id.
	 * @return int
	 * 		An operation code (see CEMConstants class)
	 */
	public int setEventId(Integer p_nEventId){
		int nRc = 0;
		
		try{
			m_nEventId = p_nEventId;	
		}
		catch (RuntimeException e){
			nRc = CEM_RETURN_CODE_ABEND;
		}
		return nRc;
	} // setEventId()

	//**************************************************************
	// Method: setName
	// Description: The setter of the name. Used when an event needs
	//				to be modified.
	//**************************************************************
	/**
	 * @param p_sName
	 * 		The new name given to the event.
	 * @return int
	 * 		An operation code (see CEMConstants class)
	 */
	public int setName(String p_sName){
		int nRc = 0;
		
		try{
			m_sEventName = p_sName;	
		}
		catch (RuntimeException e){
			nRc = CEM_RETURN_CODE_ABEND;
		}
		
		return nRc;
	} // setName()	

	//**************************************************************
	// Method: setStartingTime
	// Description: The setter of the starting time. Used when an event
	//				needs to be modified.
	//**************************************************************
	/**
	 * @param p_oStartTime
	 * 		The new starting time.
	 * @return int
	 * 		An operation code (see CEMConstants class)
	 */
	public int setStartingTime(Timestamp p_oStartTime){
		int nRc = 0;
		
		try{
			m_oEventStartTime = p_oStartTime;	
		}
		catch (RuntimeException e){
			nRc = CEM_RETURN_CODE_ABEND;
		}
		return nRc;
	} // setStartingTime()	
	
	//**************************************************************
	// Method: setEndingTime
	// Description: The setter of the ending time. Used when an event
	//				needs to be modified.
	//**************************************************************
	/**
	 * @param p_oEndTime
	 * 		The new ending time.
	 * @return int
	 * 		An operation code (see CEMConstants class)
	 */
	public int setEndingTime(Timestamp p_oEndTime){
		int nRc = 0;
		
		try{
			m_oEventEndTime = p_oEndTime;	
		}
		catch (RuntimeException e){
			nRc = CEM_RETURN_CODE_ABEND;
		}
		return nRc;
	} // setEndingTime()
	
	//**************************************************************
	// Method: setDescription
	// Description: The setter of the description. Used when an event need
	//				to be modified.
	//**************************************************************
	/**
	 * @param p_sDescription
	 * 		The new description.
	 * @return int
	 * 		An operation code (see CEMConstants class)
	 */
	public int setDescription(String p_sDescription){
		int nRc = 0;
		
		try{
			m_sEventDescription = p_sDescription;	
		}
		catch (RuntimeException e){
			nRc = CEM_RETURN_CODE_ABEND;
		}
		return nRc;
	} // setDescription()
	
	//**************************************************************
	// Method: setAgendaId
	// Description: The setter of the agenda id. Used when an event
	//				needs to be modified.
	//**************************************************************
	/**
	 * @param p_nAgendaId
	 * 		The new agenda id of the event.
	 * @return int
	 * 		An operation code (see CEMConstants class)
	 */
	public int setAgendaId(Integer p_nAgendaId){
		int nRc = 0;
		
		try{
			m_nAgendaId = p_nAgendaId;	
		}
		catch (RuntimeException e){
			nRc = CEM_RETURN_CODE_ABEND;
		}
		return nRc;
	} // setAgendaId()
	
	//**************************************************************
	// Method: getEventId
	// Description: Returns the Id of the current event
	//**************************************************************
	/**
	 * @return int
	 * 		The Id of the event.
	 */
	public int getEventId() {
		return m_nEventId;
	} // getEventId()
	
	//**************************************************************
	// Method: getName
	// Description: Returns the name of the current event
	//**************************************************************
	/**
	 * @return String
	 * 		The name of the current event.
	 */
	public String getName(){
		return m_sEventName;
	} // getName()
	
	//**************************************************************
	// Method: getStartingTime
	// Description: Returns the starting time of the current event
	//**************************************************************
	/**
	 * @return Timestamp
	 * 		The starting time of the event.
	 */
	public Timestamp getStartingTime(){
		return m_oEventStartTime;
	} // getStartingTime()
	
	//**************************************************************
	// Method: getEndingTime
	// Description: Returns the ending time of the current event
	//**************************************************************
	/**
	 * @return Timestamp
	 * 		The ending time of the event.
	 */
	public Timestamp getEndingTime(){
		return m_oEventEndTime;
	} // getEndingTime()
	
	//**************************************************************
	// Method: getDescription
	// Description: Returns a string containing the description for
	//				the current event
	//**************************************************************
	/**
	 * @return String
	 * 		The description of the event.
	 */
	public String getDescription(){
		return m_sEventDescription;
	} // getDescription()
	
	//**************************************************************
	// Method: getAgendaId
	// Description: Returns the Id of the agenda that this event is
	//				part of
	//**************************************************************
	/**
	 * @return int
	 * 		The id of the agenda the current event is part of.
	 */
	public int getAgendaId() {
		return m_nAgendaId;
	} // getAgendaId()
	
} // CEMEvents